package com.borened.common.core.util;

import cn.hutool.core.util.StrUtil;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 主键 工具类
 *
 * @author: cch
 * @since: 2021/12/10
 */
public class IdUtils {
    /**
     * <p>
     * "121231,12132,3323" 转换为List[121231,12132,3323]
     * </p>
     * 转换逗号拼接的ids为List<Long>集合
     *
     * @param ids
     * @return
     */

    public static List<Long> toListFromStr(String ids) {
        List<String> idList = StrUtil.splitTrim(ids, ",");
        return idList.stream().map(Long::valueOf).collect(Collectors.toList());
    }
}
